Skip to content

Replace Azure Inference URL with GitHub Models API URL #236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 24, 2025

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 24, 2025

This PR migrates the codebase from the deprecated Azure inference endpoint to the new GitHub Models API endpoint, as announced in the GitHub Models deprecation notice.

Changes Made

🔗 URL Migration

  • Replace all instances of https://models.inference.ai.azure.com with https://models.github.ai/inference
  • Updated in:
    • src/backend/fastapi_app/openai_clients.py (2 instances)
    • .env.sample

🏷️ Model Name Updates

  • Add required "openai/" prefix to all GitHub Models model names:
    • Chat models: gpt-4oopenai/gpt-4o
    • Embedding models: text-embedding-3-largeopenai/text-embedding-3-large
    • Updated defaults in both openai_clients.py and dependencies.py
    • Updated sample configuration in .env.sample

🧪 Test Coverage

  • Added comprehensive tests to validate GitHub Models configuration
  • Tests verify both default values and custom environment variable overrides
  • All existing tests continue to pass

Example Usage

After this change, the correct configuration for GitHub Models is:

if API_HOST == "github":
    client = openai.OpenAI(
      base_url="https://models.github.ai/inference",
      api_key=os.environ["GITHUB_TOKEN"],
    )
    MODEL_NAME = os.getenv("GITHUB_MODEL", "openai/gpt-4o")

Validation

  • ✅ All existing functionality preserved
  • ✅ New tests validate correct URL and model name usage
  • ✅ Code quality checks pass
  • ✅ Zero remaining references to deprecated endpoint

Fixes #235.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…el names

Co-authored-by: pamelafox <297042+pamelafox@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Replace Azure Inference URL with GitHub Models API URL Replace Azure Inference URL with GitHub Models API URL Jul 24, 2025
@Copilot Copilot AI requested a review from pamelafox July 24, 2025 06:47
Copilot finished work on behalf of pamelafox July 24, 2025 06:47
@pamelafox
Copy link
Contributor

@copilot Actually, the GITHUB_BASE_URL env var isnt needed, since it is always the same. Can you remove that and always use "https://models.github.ai/inference"?

Co-authored-by: pamelafox <297042+pamelafox@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jul 24, 2025

@copilot Actually, the GITHUB_BASE_URL env var isnt needed, since it is always the same. Can you remove that and always use "https://models.github.ai/inference"?

Removed the GITHUB_BASE_URL environment variable and hard-coded the GitHub Models URL as requested. The URL https://models.github.ai/inference is now directly used in the OpenAI client configuration, and all related tests have been updated accordingly. (8f5a5e8)

Copilot finished work on behalf of pamelafox July 24, 2025 14:20
@pamelafox
Copy link
Contributor

@copilot The test file needs formatting with ruff, see the failed CI.

Co-authored-by: pamelafox <297042+pamelafox@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jul 24, 2025

@copilot The test file needs formatting with ruff, see the failed CI.

Fixed the formatting issues in the test file using ruff. All formatting and linting checks now pass. (967a13a)

Copilot finished work on behalf of pamelafox July 24, 2025 16:57
@pamelafox pamelafox marked this pull request as ready for review July 24, 2025 17:11
@pamelafox pamelafox merged commit 6fae638 into main Jul 24, 2025
14 checks passed
@pamelafox pamelafox deleted the copilot/fix-235 branch July 24, 2025 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace Azure Inference URL with GitHub Models API URL
2 participants